# -*- coding: utf-8 -*-
import scrapy

class S01Spider(scrapy.Spider):
    name = 's01'
    allowed_domains = ['blog.csdn.net']

    '''
    start_urls = ['http://blog.csdn.net/']
    def parse(self, response):
        # print(response.body)
        print('*'*30)
        print(response.xpath('//div[@class="nav_com"]/ul/li/a/text()').extract())
        print('*'*30)
    '''

    def start_requests(self):
        yield scrapy.Request(
            url='http://blog.csdn.net/',
            callback=self.parse2
        )

    def parse2(self, response):
        print('*'*30)
        print(response.xpath('//div[@class="nav_com"]/ul/li/a/text()').extract())
        print('*' * 30)